package kr.co.redcircle.service.oAuth;

import java.util.Scanner;

import org.scribe.builder.ServiceBuilder;
import org.scribe.builder.api.VimeoApi;
import org.scribe.model.Token;
import org.scribe.model.Verifier;
import org.scribe.oauth.OAuthService;

public class VimeoTestCase
{
  private static final String PROTECTED_RESOURCE_URL = "https://api.twitter.com/1/statuses/update.json";
  
  public static void main(String[] args)
  {

	  String apiKey = "fe5be553ce470816891a5c02a83742110829904a";
	  String apiSecret = "55b2002fc243a772ba24f092cd13f7f3d1f321b9";

	  OAuthService service = new ServiceBuilder().
			  provider(VimeoApi.class).
			  apiKey(apiKey).
			  apiSecret(apiSecret).
			  callback("http://broker.inpion.com/ExampleBizBrokerWASClient/VimeoOAuth.jsp").
			  build();
    
	  Scanner in = new Scanner(System.in);

	  Token requestToken = service.getRequestToken();
	  System.out.println(requestToken);
	  System.out.println(service.getAuthorizationUrl(requestToken));
	  System.out.print(">>");
	  Verifier verifier = new Verifier(in.nextLine());
	  System.out.println();

	  Token accessToken = service.getAccessToken(requestToken, verifier);
	  System.out.println("access token : " + accessToken);
/*	  
	  OAuthRequest request = new OAuthRequest(Verb.POST, PROTECTED_RESOURCE_URL);
	  request.addBodyParameter("status", "this is sparta! *");
	  service.signRequest(accessToken, request);
	  Response response = request.send();
	  System.out.println(response.getBody());
*/
  }

}